Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't insert blank lines between line comments at the end of files #401

Closed
wants to merge 1 commit into from

Conversation

nreid260
Copy link
Contributor

There was already code/testing for this, but it wasn't covering a strange case where a comment was the first line of the file.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 11, 2023
@nreid260
Copy link
Contributor Author

@cgrushko

@cgrushko
Copy link
Contributor

heh, we didn't feel this internally because we have a blank line between the first line (comment) and the package statement :)
Can you add a test that makes sure that an existing blank line is preserved?

@facebook-github-bot
Copy link
Contributor

@cgrushko has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

There was already code/testing for this, but it wasn't covering a strange case where a comment was the first line of the file.
@nreid260
Copy link
Contributor Author

heh, we didn't feel this internally because we have a blank line between the first line (comment) and the package statement :) Can you add a test that makes sure that an existing blank line is preserved?

Done

@facebook-github-bot
Copy link
Contributor

@cgrushko has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@cgrushko
Copy link
Contributor

Apologies for the delay, everybody seems to be unavailable this week at the same time :(

@nreid260
Copy link
Contributor Author

Yeah, I know the feeling. Here too.

@facebook-github-bot
Copy link
Contributor

@cgrushko merged this pull request in b6e5f35.

@hick209
Copy link
Contributor

hick209 commented May 30, 2023

Overall this looks like a good improvement.
In our tests to see what changes though, we found this regression.

With this change this code here, which should not be touched

// License

package /* comment */ com.example.ktfmt /* comment */

import com.example.ImportOne
import com.example.ImportTwo
// ...

Gets formatted to this – removing empty line separating package declaration and imports

// License

package /* comment */ com.example.ktfmt /* comment */
import com.example.ImportOne
import com.example.ImportTwo
// ...

Could you take a look into this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants